<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use EasyWeChat\Foundation\Application;


class WebController extends Controller
{
  // 测试页面
  public function index()
  {
    $options = [
      'debug'  => true,
      'app_id' =>  env('WECHAT_APP_ID'),
      'secret' =>  env('WECHAT_APP_SECRET'),
      'token'  =>  env('WECHAT_APP_TOKEN'),
      'aes_key' => env('WECHAT_APP_AES_KEY'), // 可选
      'log' => [
        'level' => 'debug',
        'file'  => '/var/www/wechat/storage/logs/wechat.log',
      ],
    ];
    $wechat = new Application($options);
    $jweixin = $wechat->js;
    return view('web.index')
           ->withjweixin($jweixin);
  }
}
